package com.jiali.backend.controller;

import com.jiali.backend.common.ResponseResult;
import com.jiali.backend.service.OrderStatisticsService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/statistics/orders")
public class OrderStatisticsController {
    @Resource
    private OrderStatisticsService orderStatisticsService;

    // 1. 时间趋势统计 - 按月统计
    @GetMapping("/monthlyTrend")
    public ResponseResult<?> getMonthlyOrderTrend(HttpServletRequest request) {
        return orderStatisticsService.getMonthlyOrderTrend(request);
    }

    // 2. 服务类型分布
    @GetMapping("/by-service")
    public ResponseResult<?> getOrderDistributionByService(HttpServletRequest request) {
        return orderStatisticsService.getOrderDistributionByService(request);
    }

    // 3. 订单状态分布
    @GetMapping("/by-status")
    public ResponseResult<?> getOrderDistributionByStatus(HttpServletRequest request) {
        return orderStatisticsService.getOrderDistributionByStatus(request);
    }

    // 4. 技师工作量统计
    @GetMapping("/by-technician")
    public ResponseResult<?> getOrderDistributionByTechnician(HttpServletRequest request) {
        return orderStatisticsService.getOrderDistributionByTechnician(request);
    }
}